import 'package:flutter/material.dart';
import 'package:meal/constant/sizes.dart';
import 'package:meal/utils/colors.dart';
import 'package:meal/utils/styles.dart';
import 'package:meal/utils/tools.dart';

///
/// 商品规格
///
class ProductStandards extends StatefulWidget {
  const ProductStandards({Key? key}) : super(key: key);

  @override
  State<ProductStandards> createState() => _ProductStandardsState();
}

class _ProductStandardsState extends State<ProductStandards> {

  double get leftWidth {
    return Sizes.default90;
  }

  double get rowHeight {
    return Sizes.default60;
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: ToolsUtils.getDefaultBackgroundColor(),
      appBar:
          ToolsUtils.getDefaultBrnAppBar('商品规格', actions: ToolsUtils.actions('确定', pressed: () {})),
      body: SingleChildScrollView(
        child: Column(
          children: [
            Container(
              margin: const EdgeInsets.only(top: Sizes.default15),
              padding: const EdgeInsets.symmetric(
                  vertical: Sizes.default10, horizontal: Sizes.default15),
              decoration: const BoxDecoration(color: Colors.white),
              child: ListBody(
                children: [
                  Container(
                    height: rowHeight,
                    alignment: Alignment.centerLeft,
                    child: Row(
                      children: [
                        Container(
                            width: leftWidth,
                            alignment: Alignment.centerLeft,
                            child: Text.rich(
                              TextSpan(
                                  text: '名称',
                                  style: StylesUtils.customTextStyle(
                                      fontSize: Sizes.default15, color: ColorsUtils.color333) ),
                            )),
                        Expanded(
                            child: Container(
                              height: Sizes.default45,
                              padding: const EdgeInsets.symmetric(horizontal: Sizes.default10),
                              decoration: BoxDecoration(
                                  color: ColorsUtils.rgba(247, 247, 247, 1),
                                  borderRadius:
                                  const BorderRadius.all(Radius.circular(Sizes.default10))),
                              child: TextField(
                                style: StylesUtils.customTextStyle(
                                    color: ColorsUtils.color363, fontSize: Sizes.default15),
                                decoration: InputDecoration(
                                    border: const OutlineInputBorder(
                                      borderSide: BorderSide.none,
                                    ),
                                    isCollapsed: true,
                                    filled: true,
                                    fillColor: Colors.transparent,
                                    contentPadding: const EdgeInsets.symmetric(
                                        horizontal: Sizes.default10, vertical: Sizes.default10),
                                    constraints: const BoxConstraints(minHeight: Sizes.default45),
                                    hintText: '如大份',
                                    hintStyle: StylesUtils.customTextStyle(
                                        fontSize: Sizes.default14, color: ColorsUtils.color999)),
                                keyboardType: TextInputType.number,
                                onChanged: (String content) {},
                              ),
                            ))
                      ],
                    ),
                  ),
                  Container(
                    height: rowHeight,
                    alignment: Alignment.centerLeft,
                    child: Row(
                      children: [
                        Container(
                          width: leftWidth,
                          alignment: Alignment.centerLeft,
                          child: Text(
                            '价格',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color333),
                          ),
                        ),
                        Expanded(
                            child: Container(
                              height: Sizes.default45,
                              padding: const EdgeInsets.symmetric(horizontal: Sizes.default10),
                              margin: const EdgeInsets.only(right: Sizes.default15),
                              decoration: BoxDecoration(
                                  color: ColorsUtils.rgba(247, 247, 247, 1),
                                  borderRadius:
                                  const BorderRadius.all(Radius.circular(Sizes.default10))),
                              child: TextField(
                                style: StylesUtils.customTextStyle(
                                    color: ColorsUtils.color363, fontSize: Sizes.default15),
                                decoration: InputDecoration(
                                    border: const OutlineInputBorder(
                                      borderSide: BorderSide.none,
                                    ),
                                    isCollapsed: true,
                                    filled: true,
                                    fillColor: Colors.transparent,
                                    contentPadding: const EdgeInsets.symmetric(
                                        horizontal: Sizes.default10, vertical: Sizes.default10),
                                    constraints: const BoxConstraints(minHeight: Sizes.default45),
                                    hintText: '请输入金额',
                                    hintStyle: StylesUtils.customTextStyle(
                                        fontSize: Sizes.default14, color: ColorsUtils.color999)),
                                keyboardType: TextInputType.text,
                                onChanged: (String content) {},
                              ),
                            )),
                        Container(
                          alignment: Alignment.centerRight,
                          child: Text('￥',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color333)),
                        )
                      ],
                    ),
                  ),
                  Container(
                    height: rowHeight,
                    alignment: Alignment.centerLeft,
                    child: Row(
                      children: [
                        Container(
                          width: leftWidth,
                          alignment: Alignment.centerLeft,
                          child: Text(
                            '库存数量',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color333),
                          ),
                        ),
                        Expanded(
                            child: Container(
                              height: Sizes.default45,
                              padding: const EdgeInsets.symmetric(horizontal: Sizes.default10),
                              margin: const EdgeInsets.only(right: Sizes.default15),
                              decoration: BoxDecoration(
                                  color: ColorsUtils.rgba(247, 247, 247, 1),
                                  borderRadius:
                                  const BorderRadius.all(Radius.circular(Sizes.default10))),
                              child: TextField(
                                style: StylesUtils.customTextStyle(
                                    color: ColorsUtils.color363, fontSize: Sizes.default15),
                                decoration: InputDecoration(
                                    border: const OutlineInputBorder(
                                      borderSide: BorderSide.none,
                                    ),
                                    isCollapsed: true,
                                    filled: true,
                                    fillColor: Colors.transparent,
                                    contentPadding: const EdgeInsets.symmetric(
                                        horizontal: Sizes.default10, vertical: Sizes.default10),
                                    constraints: const BoxConstraints(minHeight: Sizes.default45),
                                    hintText: '1-9999',
                                    hintStyle: StylesUtils.customTextStyle(
                                        fontSize: Sizes.default14, color: ColorsUtils.color999)),
                                keyboardType: TextInputType.text,
                                onChanged: (String content) {},
                              ),
                            )),
                        Container(
                          alignment: Alignment.centerRight,
                          child: Text('份',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color333)),
                        )
                      ],
                    ),
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}
